package cn.itsource.config.web;

/**
 * <p>描述</p>
 *
 * @author 波波老师(微信 ： javabobo0513)
 * @date 2022/11/18-15:49
 */

import cn.itsource.interceptor.CheckPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 统一拦截器配置类
 */
@Configuration
public class WebConfig extends WebMvcConfigurationSupport {

    @Autowired
    private CheckPermission checkPermission;

    //添加自定义拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(checkPermission).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}